package com.xc.voicechat.config;

import com.alibaba.cloud.nacos.utils.StringUtils;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Objects;

@Component
@Getter
@Setter
public class VoiceChatConfig {

    @Value("${spring.ai.dashscope.api-key}")
    private String apiKey;

    @Value("${chat.welcome-message: 喂，你好呀。}")
    private String welcomeMessage;

    @Value("${chat.security:}")
    private String security;

    public static final String audioPath = System.getProperty("user.dir") + "/audio";


    public boolean isEnableAuth() {
        return !StringUtils.isEmpty(security);
    }

    public boolean auth(String code) {
        return Objects.equals(security, code);
    }
}
